package complexity;

public class Bubble {
    public static void sort(Comparable[] arr){
        for (int i = arr.length - 1; i > 0; i--) {
            for (int j = 0; j < i; j++) {
                if (greater(arr[j],arr[j+1])){
                    exChange(arr,j,j+1);
                }
            }
        }
    }
    public static boolean greater(Comparable s,Comparable v){
        return s.compareTo(v)>0;
    }
    public static void exChange(Comparable[] com,int i,int j){
        Comparable comparable = com[i];
        com[i]=com[j];
        com[j]=comparable;
    }
}
